//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2010, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************

//**********************************************************************
// $Header: /Alaska/Tools/template.c 6     1/13/10 2:13p Felixp $
//
// $Revision: 6 $
//
// $Date: 1/13/10 2:13p $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/Tools/template.c $
// 
// 6     1/13/10 2:13p Felixp
// 
//**********************************************************************
//<AMI_FHDR_START>
//
// Name:  <This File's Name>
//
// Description:	
//
//<AMI_FHDR_END>
//**********************************************************************

#include <AmiDxeLib.h>
#include <Include/Uefi/UefiBaseType.h>
#include <OemDxeLib\OemDxeLib.h>

//WRITE TO CMOS
EFI_STATUS CMOSWRITETest(IN EFI_EVENT Event, IN VOID *Context)
{

    CmosDxeWrite(0xE1,0xE1);
    
	pBS->CloseEvent(Event);
	
    return EFI_SUCCESS;
}

//
// use EfiCreateProtocolNotifyEvent to Create protocol callback event  
//  use CreateReadyToBootEvent to creat a event
//
EFI_STATUS OemEventEntryPoint(
	IN EFI_HANDLE ImageHandle,
	IN EFI_SYSTEM_TABLE *SystemTable
)
{   
    EFI_STATUS                  Status;
    EFI_EVENT                   Event;
    VOID                        *OemEvent;
    EFI_GUID OemguidReadyToBoot = EFI_EVENT_GROUP_READY_TO_BOOT;
    
	InitAmiLib(ImageHandle,SystemTable);
//
// Create the event
//
	Status = pBS->CreateEvent(
                             EVT_NOTIFY_SIGNAL,
                             TPL_CALLBACK,
							 CMOSWRITETest,
                             NULL,
                             &Event
                             );
//
// Register for protocol notifications on this event
//	
	if (!EFI_ERROR (Status)){
		Status = pBS->RegisterProtocolNotify (
						&OemguidReadyToBoot,
						Event,
						&OemEvent
						);
	}

	return EFI_SUCCESS;
}

//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2010, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************
